home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-08-25 | 5.3 KB | 195 lines | [TEXT/ttxt] |
- module: Dylan-User
- author: chiles@cs.cmu.edu
- synopsis: This file defines the Streams library and its modules.
- copyright: See below.
- rcs-header: $Header: library.dylan,v 1.11 94/08/23 10:33:39 chiles Exp $
-
- //======================================================================
- //
- // Copyright (c) 1994 Carnegie Mellon University
- // All rights reserved.
- //
- // Use and copying of this software and preparation of derivative
- // works based on this software are permitted, including commercial
- // use, provided that the following conditions are observed:
- //
- // 1. This copyright notice must be retained in full on any copies
- // and on appropriate parts of any derivative works.
- // 2. Documentation (paper or online) accompanying any system that
- // incorporates this software, or any part of it, must acknowledge
- // the contribution of the Gwydion Project at Carnegie Mellon
- // University.
- //
- // This software is made available "as is". Neither the authors nor
- // Carnegie Mellon University make any warranty about the software,
- // its performance, or its conformity to any specification.
- //
- // Bug reports, questions, comments, and suggestions should be sent by
- // E-mail to the Internet address "gwydion-bugs@cs.cmu.edu".
- //
- //======================================================================
- //
-
-
- ///
- /// These definitions go into the Dylan-User module because this is how we
- /// jumpstart a library.
- ///
-
- define library streams
- use dylan;
- export streams, standard-io;
- end library;
-
-
- /// The Internals Module exports everything that is necessary to make the
- /// code in the Streams Module run.
- ///
- define module internals
- use dylan;
- use extensions,
- import: {<boolean>, <byte-vector>, one-of, type-or, ignore, on-exit},
- export: all;
- use system,
- import: {<buffer>, copy-bytes},
- export: all;
- use threads,
- import: {<multilock>, <semaphore>, grab-lock, release-lock},
- export: all;
- use file-descriptors,
- // This is one of two use file-descriptors clauses. This one prefixes
- // everything with "fd-"
- import: {// Lseek values for whence argument.
- l_set => fd-seek-start,
- l_incr => fd-seek-current,
- l_xtnd => fd-seek-end,
-
- // Open values for flags argument
- o_rdonly, o_wronly, o_rdwr, o_creat, o_trunc, o_excl,
-
- // Open errors.
- enoent, eexist},
- prefix: "fd-",
- export: all;
- use file-descriptors,
- // This is two of two use file-descriptors clauses. This one does no
- // prefixing.
- import: {fd-read, fd-write, fd-open, fd-close, fd-seek,
- fd-input-available?, fd-sync-output, fd-error-string},
- export: all;
- export
- // Classes and types.
- <byte>,
- <byte-character>,
- <fixed-integer>,
-
- // Constants.
- $maximum-fixed-integer,
-
- // Utilities.
- call-fd-function;
- end module;
-
- define module streams
- // These renames exist to test the module system. After running this code
- // once, we will remove these renames.
- use dylan;
- use internals,
- import: {<boolean>, <byte-vector>, one-of, type-or, ignore, on-exit,
-
- <buffer>, copy-bytes,
-
- <multilock>, <semaphore>, grab-lock, release-lock,
-
- fd-seek-start, fd-seek-current, fd-seek-end, fd-o_rdonly,
- fd-o_wronly, fd-o_rdwr, fd-o_creat, fd-o_trunc, fd-o_excl,
- fd-enoent, fd-eexist, fd-read, fd-write, fd-open, fd-close,
- fd-seek, fd-input-available?, fd-sync-output, fd-error-string,
-
- <byte>, <byte-character>, <fixed-integer>,
- $maximum-fixed-integer, call-fd-function},
- export: {<byte-vector>, <buffer>, <byte-character>, <byte>};
- export
- //
- // Classes and types.
- <stream>,
- <file-stream>,
- <string-stream>,
- <string-input-stream>,
- <byte-string-input-stream>,
- <string-output-stream>,
- <byte-string-output-stream>,
- <buffer-index>,
- //
- // Constants.
- $maximum-buffer-size,
- //
- // Conditions.
- <end-of-file>,
- <file-not-found>,
- <file-exists>,
- //
- // Stream Extension Protocol.
- close,
- stream-extension-get-input-buffer,
- stream-extension-release-input-buffer,
- fill-input-buffer,
- input-available-at-source?,
- stream-extension-get-output-buffer,
- stream-extension-release-output-buffer,
- force-output-buffer,
- synchronize-output-buffer,
- //
- // Basic I/O Protocol.
- read-byte,
- peek-byte,
- read-line,
- input-available?,
- flush-input,
- write-byte,
- force-output,
- synchronize-output,
- //
- // Buffer Access Protocol.
- get-input-buffer,
- release-input-buffer,
- get-output-buffer,
- release-output-buffer,
- //
- // Data Extension Protocol.
- read-as,
- read-into!,
- write,
- write-line,
- //
- // <random-access-stream> protocol.
- stream-position,
- stream-position-setter,
- adjust-stream-position,
- stream-size,
- //
- // <string-output-stream> protocol.
- string-output-stream-string,
- //
- // <buffer> protocol.
- buffer-subsequence,
- copy-from-buffer!,
- copy-into-buffer!,
- //
- // Conditions operations.
- end-of-file-stream,
- file-not-found-filename,
- file-exists-filename,
-
- // The following are extensions to the standard Streams Library.
- <fd-stream>;
- end module;
-
- define module standard-io
- use dylan;
- use streams,
- import: {<fd-stream>};
- export
- *standard-input*, *standard-output*, standard-error*;
- end module
-